package com.boxs;

public class Vehicle {

    private double speed;
    private String type;

    public Vehicle(){
        speed = 50;
        type = "吉利";
        System.out.println(type+"速度"+speed+"迈---");
    }

    public void move(){
        System.out.println(type+"速度"+speed+"迈---");
    }

    public void setSpeed(double num) {
        speed = num;
    }

    public void setSpeedUp(double num) {
        speed += num;
    }

    public void setSpeedDown(double num) {
        if (speed >= num) {
            speed -= num;
        }else {
            speed = 0;
        }
    }

    public static void main(String[] args) {
        Vehicle vehicle = new Vehicle();
        vehicle.move();
        vehicle.setSpeed(140);
        vehicle.move();
        vehicle.setSpeedDown(60);
        vehicle.move();
        vehicle.setSpeedUp(50);
        vehicle.move();

    }


}
